/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package server.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author USER
 */
@Entity
@Table(name = "Vote", catalog = "WebPhotoShare", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Vote.findAll", query = "SELECT v FROM Vote v"),
    @NamedQuery(name = "Vote.findByIdVote", query = "SELECT v FROM Vote v WHERE v.idVote = :idVote"),
    @NamedQuery(name = "Vote.findByMark", query = "SELECT v FROM Vote v WHERE v.mark = :mark"),
    @NamedQuery(name = "Vote.findByVoteComment", query = "SELECT v FROM Vote v WHERE v.voteComment = :voteComment"),
    @NamedQuery(name = "Vote.findByVoteDate", query = "SELECT v FROM Vote v WHERE v.voteDate = :voteDate")})
public class Vote implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IdVote", nullable = false)
    private Integer idVote;
    @Basic(optional = false)
    @Column(name = "Mark", nullable = false)
    private int mark;
    @Column(name = "VoteComment", length = 500)
    private String voteComment;
    @Basic(optional = false)
    @Column(name = "voteDate", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date voteDate;
    @JoinColumn(name = "Username", referencedColumnName = "Username", nullable = false)
    @ManyToOne(optional = false)
    private RegisteredUser registeredUser;
    @JoinColumn(name = "IdImgContest", referencedColumnName = "IdImgContest", nullable = false)
    @ManyToOne(optional = false)
    private ImageContest imageContest;

    public Vote() {
    }

    public Vote(Integer idVote) {
        this.idVote = idVote;
    }

    public Vote(Integer idVote, int mark, Date voteDate) {
        this.idVote = idVote;
        this.mark = mark;
        this.voteDate = voteDate;
    }

    public Integer getIdVote() {
        return idVote;
    }

    public void setIdVote(Integer idVote) {
        this.idVote = idVote;
    }

    public int getMark() {
        return mark;
    }

    public void setMark(int mark) {
        this.mark = mark;
    }

    public String getVoteComment() {
        return voteComment;
    }

    public void setVoteComment(String voteComment) {
        this.voteComment = voteComment;
    }

    public Date getVoteDate() {
        return voteDate;
    }

    public void setVoteDate(Date voteDate) {
        this.voteDate = voteDate;
    }

    public RegisteredUser getRegisteredUser() {
        return registeredUser;
    }

    public void setRegisteredUser(RegisteredUser registeredUser) {
        this.registeredUser = registeredUser;
    }

    public ImageContest getImageContest() {
        return imageContest;
    }

    public void setImageContest(ImageContest imageContest) {
        this.imageContest = imageContest;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idVote != null ? idVote.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vote)) {
            return false;
        }
        Vote other = (Vote) object;
        if ((this.idVote == null && other.idVote != null) || (this.idVote != null && !this.idVote.equals(other.idVote))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "server.entity.Vote[idVote=" + idVote + "]";
    }

}
